Skip to content

feat: [Remote rendering 3.4] server-owned UI panel and theme state - #144

Merged
LKasianAnsys merged 1 commit into
mainfrom
feat/3.4-server-owned-ui-state
Oct 2, 2026
Merged

LKasianAnsys merged 1 commit into
mainfrom
feat/3.4-server-owned-ui-state

Conversation

@LKasianAnsys

@LKasianAnsys LKasianAnsys commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

Issue

Resolves #22

Context

This is user story 4 in Phase 3 of the remote rendering epic, where the viewer state ownership is moved from client to server. 3.4 sees the panel layout and theme become server-authoritative.

Previously, the UI state was read from the browser on save_state and written into the persisted state, and was passed back through to the viewer on load_state, but the server itself held no record of it. This PR changes that: it adds a server-side record for the UI panel state, has the client sync it on panel collapse/expand and tab selection, seeds the browser from it on a refresh and rebuild, and uses it for save/load. The dark theme gets no trigger, as no control exists on the browser, and the server already owns dark_mode, so save_state now records the server's value rather than the browser's.

Fixed, pre-existing:

  • The properties panel previously initialized itself empty on mount, so a part selected before the panel mounted (a refresh) showed as selected in the tree and on the mesh but not in the panel. It now reads the tree view's current selection at mount.

Copilot summary

This pull request introduces server-owned UI panel and theme state management for remote rendering, enhancing consistency and reliability in the UI's appearance and layout. The main changes implement a unified VisorUIState model on the server, which now tracks theme and panel layout state, and ensures these are synchronized between frontend and backend. This involves new payload models, updated state handling, and refactored state application and retrieval logic.

UI State Management Enhancements

  • Introduced a VisorUIState model to hold theme and panel layout state on the server, replacing separate dark_mode handling and ensuring all UI state is owned and managed centrally. (src/ansys/visor/viewer/vtk/scene/base.py, src/ansys/visor/viewer/models/common/visor_ui_state.py)
  • Updated state construction and application methods (from_components, apply_state, get_state, get_scene_details) to use the unified VisorUIState object, passing the full UI state record rather than individual fields. (src/ansys/visor/viewer/models/runtime/scene/runtime_app_state.py, src/ansys/visor/viewer/models/runtime/visor_scene_details.py, src/ansys/visor/viewer/vtk/scene/base.py) [1] [2] [3]

Panel Layout State Synchronization

  • Added new payload models for panel layout state: SetPanelTopLeftPanelCollapsedPayload, SetPanelTopRightPanelCollapsedPayload, SetPanelTopRightLegendCollapsedPayload, and SetPanelTopRightTabIndexPayload, each carrying the relevant UI state from frontend to backend. (src/ansys/visor/viewer/models/runtime/requests/widget_state_payloads.py)
  • Implemented new backend triggers and handlers in LocalApp to receive and apply these panel layout state changes from the frontend. (src/ansys/visor/viewer/app/trame/local_app.py)

These changes collectively ensure that the server is the source of truth for UI theme and panel layout, improving synchronization and reliability in multi-user or remote rendering scenarios.

@github-actions github-actions Bot added test Work associated with testing added labels Sep 25, 2026
@LKasianAnsys LKasianAnsys self-assigned this Sep 25, 2026
@github-actions github-actions Bot added the enhancement New feature or request label Sep 25, 2026
@LKasianAnsys LKasianAnsys changed the title Feat/3.4 server owned UI state feat: [Remote rendering 3.4] server-owned UI panel and theme state Sep 25, 2026
@LKasianAnsys
LKasianAnsys changed the base branch from main to feat/3.3d-sync-orientation-widget-to-server September 25, 2026 17:04
@LKasianAnsys
LKasianAnsys changed the base branch from feat/3.3d-sync-orientation-widget-to-server to main September 25, 2026 18:59
@LKasianAnsys
LKasianAnsys changed the base branch from main to feat/3.3d-sync-orientation-widget-to-server September 25, 2026 19:43
@LKasianAnsys
LKasianAnsys marked this pull request as ready for review September 25, 2026 19:43
@LKasianAnsys
LKasianAnsys force-pushed the feat/3.4-server-owned-ui-state branch from cfe1768 to ed65753 Compare September 28, 2026 13:51
@LKasianAnsys
LKasianAnsys changed the base branch from feat/3.3d-sync-orientation-widget-to-server to feat/3.3c-server-authoritative-cross-section-plane September 28, 2026 13:51
@LKasianAnsys
LKasianAnsys force-pushed the feat/3.3c-server-authoritative-cross-section-plane branch from b87c85f to b9222fd Compare September 28, 2026 17:09
@LKasianAnsys
LKasianAnsys force-pushed the feat/3.4-server-owned-ui-state branch 3 times, most recently from 142bdea to b4b6d72 Compare October 1, 2026 16:59
@LKasianAnsys
LKasianAnsys force-pushed the feat/3.3c-server-authoritative-cross-section-plane branch from de98f34 to 9fa3ad4 Compare October 1, 2026 17:15
@LKasianAnsys
LKasianAnsys force-pushed the feat/3.4-server-owned-ui-state branch 2 times, most recently from 96e4088 to 1f0c1b3 Compare October 1, 2026 17:41
@LKasianAnsys
LKasianAnsys changed the base branch from feat/3.3c-server-authoritative-cross-section-plane to feat/3.3d-sync-orientation-widget-to-server October 1, 2026 17:44
@LKasianAnsys
LKasianAnsys force-pushed the feat/3.4-server-owned-ui-state branch 2 times, most recently from 8b0e846 to c117749 Compare October 1, 2026 18:05
@LKasianAnsys
LKasianAnsys changed the base branch from feat/3.3d-sync-orientation-widget-to-server to main October 1, 2026 18:25
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Oct 1, 2026
@LKasianAnsys
LKasianAnsys changed the base branch from main to feat/3.3d-sync-orientation-widget-to-server October 1, 2026 18:27
@github-actions github-actions Bot removed the documentation Improvements or additions to documentation label Oct 1, 2026
@LKasianAnsys
LKasianAnsys force-pushed the feat/3.3d-sync-orientation-widget-to-server branch from b34ffb1 to 6c15e9f Compare October 1, 2026 18:42
@LKasianAnsys
LKasianAnsys force-pushed the feat/3.4-server-owned-ui-state branch from c117749 to e64851b Compare October 1, 2026 18:56
@LKasianAnsys
LKasianAnsys force-pushed the feat/3.4-server-owned-ui-state branch from e64851b to 1916c0e Compare October 1, 2026 18:58
ansBAkula
ansBAkula previously approved these changes Oct 2, 2026

@ansBAkula ansBAkula left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work. Now that all (most) UI actions are synced back instantaneously, going forward the save and load state end points are probably not needed? Is my understanding correct ?

@LKasianAnsys

Copy link
Copy Markdown
Collaborator Author

Thanks @ansBAkula. Yes the UI actions are now synced in real time within a running session. But good question. The save/load state endpoints have a separate function, of persisting the state to disk. That way if a user wants to shut down their current session, and preserve the full browser state, they can save the state to disk, and then restore it in a new process (or even on a new machine).

In this PR, the UI state is now a) synced back to the server by the browser on any of the panel/tab changes (ie keeping the runtime state up-to-date on the server) and b) having the server read from its own records (rather than the browser's copy) when a user calls save_state to write the persisted state to disk, and loads it back into its records from a state file on load_state.

@LKasianAnsys
LKasianAnsys force-pushed the feat/3.4-server-owned-ui-state branch from 1916c0e to f5cf3cb Compare October 2, 2026 15:51
@LKasianAnsys
LKasianAnsys changed the base branch from feat/3.3d-sync-orientation-widget-to-server to main October 2, 2026 15:51
@LKasianAnsys
LKasianAnsys dismissed ansBAkula’s stale review October 2, 2026 15:51

The base branch was changed.

@LKasianAnsys
LKasianAnsys merged commit d148063 into main Oct 2, 2026
5 checks passed
@LKasianAnsys
LKasianAnsys deleted the feat/3.4-server-owned-ui-state branch October 2, 2026 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

added enhancement New feature or request test Work associated with testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Remote rendering 3.4] UI panel and theme state authority

3 participants